package com.justcommodity.tutorial;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Human {
	
	private Date dateOfBirth;
	
	public Human() {
	}
	
	public Human(Date dateOfBirth) {
		this.dateOfBirth = dateOfBirth;
	}
	
	public String getMaturity() {
		Calendar birthCalendar = new GregorianCalendar();
		birthCalendar.setTime(dateOfBirth);
		Calendar today = new GregorianCalendar();
		int age = today.get(Calendar.YEAR) - birthCalendar.get(Calendar.YEAR);
		if(age < 5) {
			return "BALITA";
		} else if (age > 5 && age <= 14) {
			return "ANAK ANAK ABG";
		} else if(age > 14 && age <= 23) {
			return "ALAY";
		} else if(age > 23 && age <= 30) {
			return "DEWASA";
		}
		return "OLD";
	}

	public Date getDateOfBirth() {
		return dateOfBirth;
	}

	public void setDateOfBirth(Date dateOfBirth) {
		this.dateOfBirth = dateOfBirth;
	}
}
